#!/bin/sh

sudo apt install -y build-essential cmake libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev
git clone --recursive https://github.com/nmwsharp/polyscope.git
cmake -Bb -DCMAKE_BUILD_TYPE:STRING=Release polyscope/
cmake --build b
sudo cmake --build b -t install
sudo cp polyscope/deps/imgui/imgui/imgui.h /usr/local/include/
sudo cp polyscope/deps/imgui/imgui/imconfig.h /usr/local/include/
sudo cp polyscope/deps/implot/implot.h /usr/local/include/
sudo cp polyscope/b/deps/imgui/libimgui.a /usr/local/lib/
sudo cp polyscope/b/deps/glfw/src/libglfw3.a /usr/local/lib/
sudo cp polyscope/b/deps/glad/src/libglad.a /usr/local/lib/
sudo cp polyscope/b/deps/stb/libstb.a /usr/local/lib/
sudo cp polyscope/b/deps/glm/glm/libglm.a /usr/local/lib/
cmake -Bc -DGLM_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF polyscope/deps/glm
sudo cmake --build c -- install
cmake -Bd -DCMAKE_BUILD_TYPE:STRING=Release .
cmake --build d
